﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

namespace WebSite.cn
{
    public partial class pic : System.Web.UI.Page
    {
        // Fields
        public string imgurl = "";

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Shoppro where proid=" + re.replace(base.Request.QueryString["pid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                this.imgurl = "../../uploadfile/product/" + table.Rows[0]["propic1"].ToString();
                this.image1.ImageUrl = this.imgurl;
              //  this.Image1.ImageUrl = "../../uploadfile/product/" + table.Rows[0]["propic2"].ToString();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string str = "0";
            string str2 = "0";
            string str4 = "0";
            DataTable table = SQLAccess.GreatDs("select * from DB_Shoppro where proid=" + re.replace(base.Request.QueryString["pid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                str = table.Rows[0]["typeid"].ToString();
                str2 = table.Rows[0]["proid"].ToString();
            }
            DataTable table2 = SQLAccess.GreatDs("select * from DB_Shoppro where visible=1 and typeid=" + str.ToString() + " and proid<>" + str2.ToString() + " and proisshow=1 order by updatetime asc").Tables[0];
            if (table2.Rows.Count > 0)
            {
                str4 = table2.Rows[0]["proid"].ToString();
            }
            else
            {
                str4 = re.replace(base.Request.QueryString["pid"]);
            }
            base.Response.Write("<script language='javascript'>window.location.href='pic.aspx?pid=" + str4.ToString() + "';</script>");
            base.Response.End();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string str = "0";
            string str2 = "0";
            string str4 = "0";
            DataTable table = SQLAccess.GreatDs("select * from DB_Shoppro where proid=" + re.replace(base.Request.QueryString["pid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                str = table.Rows[0]["typeid"].ToString();
                str2 = table.Rows[0]["proid"].ToString();
            }
            DataTable table2 = SQLAccess.GreatDs("select * from DB_Shoppro where visible=1 and typeid=" + str.ToString() + " and proid<>" + str2.ToString() + " and proisshow=1 order by updatetime desc").Tables[0];
            if (table2.Rows.Count > 0)
            {
                str4 = table2.Rows[0]["proid"].ToString();
            }
            else
            {
                str4 = re.replace(base.Request.QueryString["pid"]);
            }
            base.Response.Write("<script language='javascript'>window.location.href='pic.aspx?pid=" + str4.ToString() + "';</script>");
            base.Response.End();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack && (base.Request.QueryString["pid"] != null))
            {
                this.Bind();
            }
        }



    }
}